package xin.nick.minicat;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

/**
 * @author Nick
 * @date 2021/6/20
 * @description 上下文
 */
public class MiniCatContent {

    /**
     * 默认项目为ROOT
     */
    private String defaultProjectName = "ROOT";

    /**
     * webapps路径
     */
    private String appBase = "";

    /**
     * 各个项目对应的配置文件
     */
    private Map<String, MiniCatConfiguration> projectConfigurationMap = new HashMap<String, MiniCatConfiguration>();

    /**
     * 核心线程数
     */
    private int corePoolSize = 10;

    /**
     * 最大线程数
     */
    private int maxNumPoolSize = 50;

    /**
     * 线程存活时间
     */
    private long keepAliveTime = 100L;

    /**
     * 时间存活单位
     */
    private TimeUnit unit = TimeUnit.SECONDS;

    /**
     * 默认端口
     */
    private int port = 1996;

    /**
     * 所有的项目列表
     */
    private List<String> projectList = new ArrayList<>();

    public String getDefaultProjectName() {
        return defaultProjectName;
    }

    public void setDefaultProjectName(String defaultProjectName) {
        this.defaultProjectName = defaultProjectName;
    }

    public Map<String, MiniCatConfiguration> getProjectConfigurationMap() {
        return projectConfigurationMap;
    }

    public void setProjectConfigurationMap(Map<String, MiniCatConfiguration> projectConfigurationMap) {
        this.projectConfigurationMap = projectConfigurationMap;
    }

    public int getCorePoolSize() {
        return corePoolSize;
    }

    public void setCorePoolSize(int corePoolSize) {
        this.corePoolSize = corePoolSize;
    }

    public int getMaxNumPoolSize() {
        return maxNumPoolSize;
    }

    public void setMaxNumPoolSize(int maxNumPoolSize) {
        this.maxNumPoolSize = maxNumPoolSize;
    }

    public long getKeepAliveTime() {
        return keepAliveTime;
    }

    public void setKeepAliveTime(long keepAliveTime) {
        this.keepAliveTime = keepAliveTime;
    }

    public TimeUnit getUnit() {
        return unit;
    }

    public void setUnit(TimeUnit unit) {
        this.unit = unit;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public List<String> getProjectList() {
        return projectList;
    }

    public void setProjectList(List<String> projectList) {
        this.projectList = projectList;
    }

    public String getAppBase() {
        return appBase;
    }

    public void setAppBase(String appBase) {
        this.appBase = appBase;
    }

    public void init() {
        this.projectConfigurationMap = projectConfigurationMap;

    }
}
